﻿using System;
using System.Collections.Generic;
using System.DirectoryServices.ActiveDirectory;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Forms.VisualStyles;
using Macad.Common;
using Macad.Interaction;
using Macad.Occt;

namespace SpCad.Tools
{
    public class ShapeTools
    { 
        public static ShapeBase Create(TopoDS_Edge tshape)
        {
            TopoDS_Shape Shape = tshape;
            Pnt EndPoint, StartPoint;
            double First=0, Last=0;
            Geom_Curve Curve = BRep_Tool.Curve(tshape, ref First, ref Last);
            StartPoint = Curve.Value(First); 
            EndPoint = Curve.Value(Last);
            switch (Curve)
            {
                case Geom_Line line: //线形

                    return new ShapeLine(tshape, line, StartPoint, EndPoint);
                case Geom_Circle circle: //园 
                  
                    return new ShapeCircle(tshape, circle, StartPoint, EndPoint);

                case Geom_Ellipse ellipse: //椭圆 
                    return new ShapeEllipse(tshape, ellipse, StartPoint, EndPoint);

                case Geom_BezierCurve bezier: //弧线
                    return new ShapeArc(tshape, bezier, StartPoint, EndPoint);

                case Geom_BSplineCurve bspline: //贝塞尔曲线
                    return new ShapeBSplineCurve(tshape, bspline, StartPoint, EndPoint);
                default:
                    return null;
            }
        } 
    }
}
